package com.truckdispatching.http.util;

import org.json.JSONException;
import org.json.JSONObject;

public abstract class TDHttpController extends BaseHttpController {

	public static String	mHostUrl	= "http://www.566560.com";
//	public static String	mHostUrl	= "http://gps2.566560.com:8080";

	@Override
	public void onRequestSuccess(String content) {
		if (content != null && content.length() > 0) {
			JSONObject json;
			try {
				json = new JSONObject(content);
				boolean result = json.getBoolean("success");
				if (result) {
					onSuccess(content);
				} else {
					onError(-1, getStringFromJSON(json, "msg", ""));
				}
			} catch (JSONException e) {
				onError(-1, "返回JSON数据异常");
			}
		} else {
			onError(-1, "没有数据返回");
		}
	}
}
